<!DOCTYPE html>
<html>
<head>
  <title><%= 'TWS Cal :: ' + @page_title or 'Page Title' %></title>

  <%# TODO: Cleaner solution than this if? %>


  <%= javascript_include_tag "jquery.js" %>
  <%= javascript_include_tag "jquery-ui.js" %>
  <%= javascript_include_tag "jrails.js" %>
  <%= javascript_include_tag "application.js" %>

  <% if @page_title != "Calendar" %>
    <%= stylesheet_link_tag :all %>
  <% else %>
    <%= javascript_include_tag "event_calendar.js" %>
  <% end %>

  <% get_page_specific_javascript(@page_title).each do |js_file|%>
    <%= javascript_include_tag js_file %>
  <% end %>

  <%= csrf_meta_tag %>

</head>
<body>
  <div id="header">
    <h1>TWS Vacation Scheduler</h1>
    <div id = "header_text">
      <% if @current_user %>
        <h3>Logged in as:  <%= link_to "#{@current_user.username} (#{@current_user.email})", user_path(@current_user)%></h3> 
                           <%= link_to '[logout]', logout_users_path %>
      <% elsif %>
        <h3>Not logged in. <%= link_to '[login]', login_users_path %> 
                           <%= link_to '[register]', new_user_path %> </h3>
      <% end %>
    </div>
  </div>
  <div id="banner">
    <%= link_to 'Calendar', calendar_path %>
    <%= link_to 'Users', users_path %>
    <%= link_to 'Events', events_path %>
  </div>

  <hr />

  <div id="content">
    <%- flash.each do |key, msg| -%>
      <div id="<%= key %>">
        <p><%= msg %></p>
        <div class="clear"></div>
      </div>
    <%- end -%>
    <div id="page_title">
      <% if @page_title != "Calendar" %>
        <h1><%= @page_title + ":" or '****Page Title****' %></h1>
      <% end %>
    </div>
    <%= yield %>
  </div>

  <div id="footer">
  </div>
</body>
</html>
